package org.destinyshine.cricket.core;

import org.destinyshine.cricket.utils.MultiMap;

import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by jianyu.liu@hnlark.com on 2016/6/22.
 *
 * @author jianyu.liu@hnlark.com
 */
public abstract class AttributesHolderSupport {

    private Map<String, Object> attributes = new HashMap<>();

    public Object getAttribute(String name) {
        return attributes.get(name);
    }

    public Enumeration getAttributeNames() {
        return Collections.enumeration(attributes.keySet());
    }

    public void setAttribute(String name, Object object) {
        attributes.put(name, object);
    }


    public void removeAttribute(String name) {
        attributes.remove(name);
    }

}
